<?php
//error_reporting(E_ALL);
include "../../include/common.inc.php";
header("Content-type: text/html; charset=utf-8");
session_start();
include "../adminyz.php";

  include WEB_CLASS.'mycrm_class.php';
  $item =new Mycrm('{tablepre}item');
  $item_list=$item->GetList(array(),0,$maxRows,'pinyin like "'.strtoupper($name_startsWith).'%"');
//=name_startsWith
  $json_ar = array();
  foreach($item_list as $key=>$item_cols){
  foreach($item_cols as $col_name=>$col_value){
    $json_ar[$key][$col_name] = ANY2UTF($col_value);
  }
  }
echo '{"records":'.json_encode($json_ar).'}';

function ANY2UTF($str)
{
  // mb_detect_encoding($str, 'UTF-8, GBK, GB2312, ISO-8859-1', true)
  $str = @mb_convert_encoding($str, 'UTF-8', 'gb2312');
  return $str;
}
?>